<template>
	<view class="back-view">
		<view class="view-background"></view>
		<view class="white-view-back">
			<view class="top-back">
				<view class="top-name">订单详情</view>
				<view class="close-back" @click="closeBtnAction">
					<image class="close-img" src="../../../static/close.png"></image>
				</view>
			</view>
			<view class="top-line"></view>
			<scroll-view scroll-y="true" class="scroll-back">
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">订单编号</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.no}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">订单状态</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.status.desc}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">下单时间</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.paidTime}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">下单人</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.buyerName}}{{detailItem.buyerMobile}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">支付金额</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.paidAmt}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name">关联客户</view>
						<view class="item-name-des">:</view>
					</view>
					<view class="item-content">{{detailItem.custName}}</view>
				</view>
				<view class="item-back ">
					<view style="display: flex;">
						<view class="item-name" style="width: 100%;">购买商品</view>
					</view>
				</view>
				<view class="item-back3" @click="clickGoodsDetailAction">
					<image class="goodsimg" mode="aspectFill" :src="detailItem.goodsPicUrls"></image>
					<view class="goodsdesback">
						<view class="goodsname">{{detailItem.goodsName}}</view>
					</view>
				</view>
				<view class="item-back ">
					<view style="display: flex;">
						<view class="item-name1">服务权益</view>
						<view class="item-name-des1">:</view>
					</view>
				</view>

				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name1">权益id</view>
						<view class="item-name-des1">:</view>
					</view>
					<view class="item-content1">{{customerRightsDTO.id}}</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name1">服务有效期</view>
						<view class="item-name-des1">:</view>
					</view>
					<view class="item-content1">{{customerRightsDTO.totalDay}}天</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name1">可发起总咨询数</view>
						<view class="item-name-des1">:</view>
					</view>
					<view class="item-content1">{{customerRightsDTO.totalCount == -1?'不限':customerRightsDTO.totalCount}}
					</view>
				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name3">
							限制每{{customerRightsDTO.cycleValue}}{{customerRightsDTO.cycleUnit.desc}}只可咨询{{customerRightsDTO.cycleTimes == -1?'不限':customerRightsDTO.cycleTimes}}次
						</view>

					</view>

				</view>
				<view class="item-back">
					<view style="display: flex;">
						<view class="item-name1">可咨询领域</view>
						<view class="item-name-des1">:</view>
					</view>
					<view class="item-content1">{{customerRightsDTO.domainDict}}</view>
				</view>
			</scroll-view>
			<view class="bottom-back">
				<view class="bottom-btn" @click="closeBtnAction">确定</view>
			</view>
		</view>
		<productDetail v-if="showDetail" :itemID='itemID' @detailClose='clickDetailClose'></productDetail>

	</view>
</template>

<script>
	import productDetail from "@/packageB/PC/productMange/productDetail.vue"

	export default {
		components: {

			productDetail
		},
		props: {
			item: {
				type: Object,
				default: {}
			},
		},
		data() {
			return {
				detailItem: {},

				customerRightsDTO: {
					id: "",
					customerName: '',
					orderNo: '',
					no: '',
					orderId: '',
					custId: '',
					custName: '',
					totalDay: '',
					beginTime: '',
					endTime: '',
					domainDict: '',
					totalCount: '',
					cycleValue: '',
					cycleUnit: '',
					cycleTimes: ''
				},
				showDetail: false,
				itemID: ''
			}
		},
		mounted() {
			this.requestInfoData();
		},
		methods: {
			//信息网络请求
			async requestInfoData() {
				let _this = this
				const res = await this.$myRequest({
					url: '/admin/goodsOrder/' + this.item.id,
					method: 'GET',
				})
				console.log('返回结果', res)
				if (res.data.code == 200) {
					_this.detailItem = res.data.data;
					if (res.data.data.customerRights) {
						_this.customerRightsDTO = res.data.data.customerRights
						var str = res.data.data.customerRights.domainDict
						if (str.includes('-1')) {
						var str1 =str.replace(/-1/g, '不限')
							_this.$set(_this.customerRightsDTO, 'domainDict', str1)
						}
					}
				}
			},
			//商品详情
			clickGoodsDetailAction() {
				this.itemID = this.detailItem.goodsId;
				this.showDetail = true;
			},

			clickDetailClose() {
				this.showDetail = false;
			},

			closeBtnAction() {
				this.$emit('orderDetailClose')
			}
		},
	}
</script>

<style>
	.back-view {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 9999;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.view-background {
		position: absolute;
		width: 100%;
		height: 100%;
		z-index: 100;
		background-color: rgba(0, 0, 0, 0.3);
	}

	.white-view-back {
		width: 600px;
		height: 550px;
		padding: 24px;
		max-height: 550px;
		background-color: white;
		margin-top: -70px;
		border-radius: 4px;
		z-index: 101;
	}

	.top-back {
		display: flex;
		justify-content: space-between;
	}

	.top-name {
		font-size: 18px;
		font-weight: normal;
		color: #333333;

	}

	.close-back {
		cursor: pointer;
		width: 20px;
		height: 20px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.close-img {
		width: 12px;
		height: 12px;
	}

	.top-line {
		height: 1px;
		background: #EEEEEE;
		width: 100%;
		margin-top: 20px;
		margin-bottom: 20px;
	}

	.item-back {
		display: flex;
		align-items: flex-start;
		margin-bottom: 10px;
	}

	.item-back3 {
		margin-left: 50px;
		margin-right: 50px;
		width: auto;
		height: 100px;
		border: #ddd 1px solid;
		border-radius: 5px;
		display: flex;
		align-items: center;
		margin-bottom: 10px;
	}

	.item-name {
		font-size: 14px;
		font-weight: 400;
		color: #555;
		width: 100px;
		min-width: 100px;
		text-align: end;
		/* text-align: justify;
		text-align-last: justify;
		display: inline-block; */
	}

	.item-name-des {

		font-size: 14px;
		font-weight: 400;
		color: #999999;
		margin-right: 16px;
	}

	.item-file-name {
		font-size: 12px;
		font-weight: 400;
		color: #333333;
	}

	.item-content {
		font-size: 14px;
		font-weight: 400;
		color: #333333;
	}

	.item-img {
		width: 24px;
		height: 24px;
		min-width: 24px;
		margin-right: 8px;
	}

	.item-name1 {
		font-size: 13px;
		font-weight: 400;
		color: #888;
		width: 100px;
		min-width: 100px;
		text-align: end;
	}

	.item-name3 {
		font-size: 13px;
		font-weight: 400;
		color: #888;
		width: 300px;
		min-width: 100px;
		text-align: start;
		margin-left: 50px;
	}

	.item-name-des1 {
		font-size: 13px;
		font-weight: 400;
		color: #888;
		margin-right: 16px;
	}

	.item-content1 {
		font-size: 13px;
		font-weight: 400;
		color: #666;
	}

	.bottom-back {
		margin-top: 10px;
		width: 100%;
		min-height: 30px;
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.bottom-btn {
		cursor: pointer;
		width: 104px;
		height: 32px;
		background: #2DA9C5;
		border-radius: 2px;
		color: #FFFFFF;
		font-size: 14px;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.list-name {
		font-size: 15px;
		font-weight: 500;
		color: #333333;
	}

	.list-item {
		font-size: 13px;
		font-weight: 400;
		color: #999;
	}

	.scroll-back {
		width: 100%;
		height: 460px;
	}

	.goodsimg {
		width: 80px;
		height: 80px;
		min-width: 80px;
		border-radius: 4px;
		margin-left: 10px;
		border: 1px solid #EEEEEE;
	}

	.goodsdesback {
		margin-left: 16px;
		margin-right: 16px;
		height: 80px;
		display: flex;
		flex-direction: column;
	}

	.goodsname {
		font-size: 18px;
		font-weight: 500;
		color: #333333;
	}
</style>
